package com.isoft.demooa.dao;

import com.isoft.demooa.entity.User;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserMapper {

    @Select("select * from tb_sysuser")
    @Results(value = {
            @Result(column = "id",property = "userId"),
            @Result(column = "name",property = "username"),
            @Result(column = "password",property = "password"),
            @Result(column = "desc",property = "desc")
    })
    List<User> selectAll();


    @Select("select count(*) from tb_sysuser where name=#{username} and password=#{password}")
    int exists(User user);
}
